<?php

namespace Summer\Shop\Http\Controllers;

use Illuminate\Routing\Controller;
use Summer\Hub\Http\Controllers\Traits\ApiReturn;
use Input;
use Config;
use Db;
use Log;
use Summer\Shop\Models\CategoryModel;


class CategoryController extends Controller
{
    use ApiReturn;

    /**
     * 分类类型，shoprom模版需要
     */
    public function type()
    {
        $return['type']=4;
        $return['name']='商品分类';
        $return['id']=0;
        return $this->apiSuccess('操作成功',$return);
    }

    /**
     * 分类列表
     */
    public function index()
    {
        $query=CategoryModel::select();
        $query->with(['cover']);
        $return=$query->getNested();
        return $this->apiSuccess('操作成功',$return);
    }
}
